<template>
  <div class="home">
    <el-menu router :default-active="defaultActive" class="home-menu" :style="{ width: '80px' }">
      <el-menu-item>
        <div class="label-item">
          <el-avatar shape="square" :size="40" src="/icons/logo.svg" />
          <span>神经元</span>
        </div>
      </el-menu-item>
      <el-menu-item index="/PocketAI">
        <div class="label-item">
          <el-avatar shape="square" :size="40" src="/icons/meetingAssistant.svg" />
          <span>会议助手</span>
        </div>
      </el-menu-item>
      <el-menu-item index="/personnelInformation">
        <div class="label-item">
          <el-avatar shape="square" :size="40" src="/icons/personInfo.svg" />
          <span>人员信息</span>
        </div>
      </el-menu-item>
    </el-menu>
    <RouterView class="home-right" />
  </div>

</template>
<script setup>
import { ref, onMounted, computed, reactive, getCurrentInstance } from 'vue'
import { useRouter, RouterView } from 'vue-router'
const router = useRouter()
import { useI18n } from 'vue-i18n'
import { appModule } from "@/stores/index";
const { t } = useI18n()

const { language, setLang } = appModule()

const lang = ref(language)
import { } from '@/api';
const { proxy } = getCurrentInstance()

const form = reactive({
  password: '',
  newPassword: '',
  confirmPassword: ''
})
//wifi列表弹窗
const isShowWiliList = ref(false)
//修改密码弹窗
const isPassword = ref(false)
//isAlert弹窗
const isAlert = ref(false)
//输入wifi密码框显示
const isShowDialogPassword = ref(false)
const ssid = ref('')

//头像
const circleUrl = ref('')
// const defaultActive = ref('/PocketAI')
onMounted(() => {
  console.log(router)
  defaultActive.value = '/' + router.currentRoute.value.path.split('/')[1]
})
const defaultActive = computed(() => {
  return '/' + router.currentRoute.value.path.split('/')[1]
})

const openAlert = () => {
  isAlert.value = true
  isShowDialogPassword.value = false
}

const handleSetLanguage = (lang) => {
  proxy.$i18n.locale = lang
  setLang(lang)
}
const toWifiList = (data) => {
  isShowWiliList.value = true
}
const upPassword = (data) => {
  isPassword.value = true
}
const openWiFiPassword = (item) => {
  ssid.value = item
  isShowDialogPassword.value = true
  isShowWiliList.value = false
}
const dialogFormVisible = ({ type }) => {
  let obj = {
    'wifiList': toWifiList,
    'password': upPassword,
    'openWiFiPassword': openWiFiPassword,
  }
  obj[type]()
}
</script>
<style lang="scss" scoped>
.el-dialog__title {
  font-weight: bold;
  color: #000;
}

.home {
  height: 100vh;
  display: flex;
  align-items: center;
  background-color: #F1F5FE;

  .home-menu {
    width: 80px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: url('@/icons/homgbackground.svg') no-repeat;
    background-size: cover;

    .el-menu-item {
      width: 100%;
      height: 100px;
      display: flex;
      justify-content: center;
      align-items: center;

      &:hover {
        background-color: #ffffff00 !important;
      }

      .label-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border-radius: 8px;

        width: 56px !important;
        height: 56px;
        padding: 5px;

        :deep(.el-avatar--square) {
          background-color: transparent !important;
        }

        span {
          display: flex;
          align-items: center;
          height: 24px;
          font-size: 12px;
        }

        .el-dropdown-link {
          display: flex;
          flex-direction: column;
          height: 100px;
        }

      }


      &:nth-child(1) {
        margin-top: 30px;
      }

      &:nth-child(5) {
        margin-top: auto;
      }

    }

    .is-active {
      .label-item {
        span {
          // color: #000 !important;
        }
        el-avatar{
          background: #F2BFBF;
        }
      }



    }

  }

  .home-right {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
  }

}
</style>
